/**
 * Changes class of children object when parent event happening
 */

$.fn.stateToggler = function(params){
	params = (params != undefined)? params:{};
	var options = {};
	options.selector = (params.selector != undefined)? params.selector:false;
	options.activeClass = (params.activeClass != undefined)? params.activeClass:false;
	options.activateEvent = (params.activateEvent != undefined)? params.activateEvent:'click';
	options.collection - $(options.selector);
	
	return this.each(function(){
		$(this).bind(options.activateEvent, function(e){
			var child = $(options.selector);
			if(child.hasClass(options.activeClass)){
				child.removeClass(options.activeClass);
			} else {
				child.addClass(options.activeClass);
			}
			return false;
		});
	});
};